#!/bin/sh

rm -rf testing
git clone $SCRIPT_URL testing
cd testing

SCENARIO_FILE=${SCENARIO_FILE:-locustfile.py}
LOCUST_OPTS="-f $SCENARIO_FILE --host=$TARGET_URL"
LOCUST_MODE=${LOCUST_MODE:-standalone}

if [ "$LOCUST_MODE" = "master" ]; then
  LOCUST_OPTS="$LOCUST_OPTS --master"
elif [ "$LOCUST_MODE" = "slave" ]; then
  LOCUST_OPTS="$LOCUST_OPTS --slave --master-host=$MASTER_HOST"
fi

echo "=> Starting locust"
echo "locust $LOCUST_OPTS"

locust $LOCUST_OPTS
